Change interfaces to be consistent for new Async paths (definitely breaks things)#1128
Merged
adamhathcock merged 38 commits intomasterfrom Jan 15, 2026
Merged
Change interfaces to be consistent for new Async paths (definitely breaks things)#1128adamhathcock merged 38 commits intomasterfrom
adamhathcock merged 38 commits intomasterfrom
Conversation
Change return types from ValueTask<T> to direct interface types (IAsyncArchive, IAsyncReader, IWriter) for wrapper methods that don't perform async work. This eliminates unnecessary async state machine allocations while maintaining the same public API behavior. Changes: - Interface definitions: Updated IArchiveFactory, IMultiArchiveFactory, IReaderFactory, IWriterFactory - Concrete factories: Updated archive factories (Zip, Tar, Rar, GZip, SevenZip) and reader-only factories (Ace, Arc, Arj) - Static factory methods: Updated ReaderFactory, ArchiveFactory, WriterFactory to use new signatures - Archive classes: Updated static OpenAsync methods in ZipArchive, TarArchive, RarArchive, SevenZipArchive, GZipArchive - Supporting changes: Updated Factory.cs and async polyfills Performance benefit: Reduced GC pressure by eliminating unnecessary state machine overhead for non-async wrapper methods.
…y.OpenAsync and use IAsyncReader - Removed 'await' keyword before ReaderFactory.OpenAsync() calls since the method returns IAsyncReader directly (not Task) - Changed ZipReader.Open() to ReaderFactory.OpenAsync() in Zip64AsyncTests.ReadForwardOnlyAsync() - Changed TarReader.Open() to ReaderFactory.OpenAsync() in TarReaderAsyncTests.Tar_BZip2_Entry_Stream_Async() - Fixed EntryStream disposal from 'await using' to 'using' since EntryStream doesn't implement IAsyncDisposable - These changes fix compilation errors where async methods were being called on IReader (synchronous) instead of IAsyncReader (asynchronous)
This was referenced Feb 23, 2026
This was referenced Mar 2, 2026
Closed
This was referenced Mar 9, 2026
Closed
This was referenced Mar 23, 2026
This was referenced Mar 30, 2026
This was referenced Apr 6, 2026
This was referenced Apr 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API thinking here: #1129
This pull request introduces several improvements and clarifications to the SharpCompress codebase and documentation, focusing on enhancing async support, updating documentation for modern usage, and cleaning up code and configuration files. The most significant changes are grouped and summarized below.
Async API Enhancements and Consistency:
AbstractArchiveby using explicit async enumerator methods for casting and updating aggregate operations to use their async variants (e.g.,AggregateAsync,AllAsync). Also addedTotalUncompressedSizeAsyncand clarifiedIsEncryptedAsyncreturn type. [1] [2]ArchiveFactoryasync methods to remove unnecessaryConfigureAwait(false), streamline calls, and eliminate redundant XML documentation comments, making the async API more idiomatic and easier to maintain. [1] [2] [3] [4] [5] [6] [7] [8]AbstractWritableArchiveto implement the newIWritableAsyncArchiveinterface and unified interface method implementations underIWritableArchiveCommon, improving consistency for writable archives. [1] [2]Documentation Updates and Modernization:
docs/API.mdto reflect modern async usage patterns, clarify types (IEntry→IArchiveEntry), provide more accurate code samples, and expand on supported compression and archive types. Also updated extraction and writer usage to reflect best practices and new APIs. [1] [2] [3] [4] [5] [6] [7]Configuration and Project Maintenance:
Microsoft.NET.ILLink.Taskpackage to central package management and enabledCentralPackageTransitivePinningEnabledin build properties to improve dependency management. [1] [2].editorconfigrule that set CS1998 (async method lacks 'await') as an error, likely to reduce noise for intentionally synchronous async methods..gitignoreand remove obsolete documentation files, reflecting a cleanup of project structure.Minor Documentation and Typo Fixes:
TotalUncompressSize→TotalUncompressedSize) for clarity and consistency.AGENTS.md.